home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / MATH / NRPAS13 / QGAUS.PAS < prev    next >
Pascal/Delphi Source File  |  1991-04-29  |  676b  |  28 lines

  1. PROCEDURE qgaus(a,b: real; VAR ss: real);
  2. (* Programs using routine QGAUS must externally define
  3. a function func(x:real):real which is to be integrated *)
  4. VAR
  5.    j: integer;
  6.    xr,xm,dx: real;
  7.    w,x: ARRAY[1..5] OF real;
  8. BEGIN
  9.    x[1] := 0.1488743389;
  10.    x[2] := 0.4333953941;
  11.    x[3] := 0.6794095682;
  12.    x[4] := 0.8650633666;
  13.    x[5] := 0.97390652;
  14.    w[1] := 0.2955242247;
  15.    w[2] := 0.2692667193;
  16.    w[3] := 0.2190863625;
  17.    w[4] := 0.1494513491;
  18.    w[5] := 0.06667134;
  19.    xm := 0.5*(b+a);
  20.    xr := 0.5*(b-a);
  21.    ss := 0;
  22.    FOR j := 1 TO 5 DO BEGIN
  23.       dx := xr*x[j];
  24.       ss := ss+w[j]*(func(xm+dx)+func(xm-dx))
  25.    END;
  26.    ss := xr*ss
  27. END;
  28.